package top.buyibuyi.course.controller.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.pojo.Semester;
import top.buyibuyi.course.service.admin.UpdateSemesterService;

@RestController
@CrossOrigin
@RequestMapping("/semester")
public class UpdateSemesterController {
    @Autowired
    private UpdateSemesterService updateSemesterService;

    @PostMapping("/updateSemester")
    public R updateSemester(@RequestBody Semester semester){
        try {
            Boolean aBoolean = updateSemesterService.updateSemester(semester);
            return R.ok().data("data",aBoolean);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
